suppose you have the following merged dataframe, notice index 2005 has three columns missing cause df1 dose not have that information. # HPI Int_rate US_GDP_Thousands Low_tier_HPI #YEAR #2001.0 80.0 2.0 50.0 50 #2002.0 85.0 3.0 55.0 51 #2003.0 88.0 2.0 65.0 52 #2004.0 85.0 2.0 55.0 50 #2005.0 NaN NaN NaN 53
If I have another dataframe or series looks like series = pd.Series([2005,100,90,70],['YEAR','HPI', 'Int_rate','US_GDP_Thousands']) Is there any way to use the series to fill out the missing columns without manually copying and pasting them? thanks
You must be logged in to post. Please login or register an account.
overlapping data is usually pretty messy. One option I know of is to do something like:
df[2005.0] = [VAR, VAR, VAR, VAR] ...replacing vars with whatever you want. I know of no great way to automatically do this though, other than maybe hunting for np.nan values, and then using some sort of logic to replace if you can find the data elsewhere.
-Harrison 9 years ago
You must be logged in to post. Please login or register an account.